<template>
  <custom-container>
    <custom-container-header no-spacing>
      <el-form :model="filters" ref="form" :disabled="loading"
               inline size="medium"
               @submit.native.prevent="gridSearch"
      >
        <el-form-item label="代理账户名:">
          <el-input v-model="filters.username" auto-complete="off" />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" native-type="submit">查询</el-button>
        </el-form-item>
      </el-form>
    </custom-container-header>
    <custom-container-body>
      <el-table :data="tableData.list" :loading="loading" element-loading-text="加载中..." border border-radius
      >
        <el-table-column
          align="center"
          prop="sub_username"
          label="代理账户名">
        </el-table-column>
        <el-table-column
          align="center"
          label="提成百分比">
          <template slot-scope="{row}">
            {{row.comm_rate | currency}}%
          </template>
        </el-table-column>

        <el-table-column
          align="center"
          label="下级代理佣金总额">
          <template slot-scope="{row}">
            {{row.comm_total | currency}}
          </template>
        </el-table-column>

        <el-table-column
          align="center"
          prop="betCount"
          label="实际发放">
          <template slot-scope="{row}">
            {{row.comm_amount | currency}}
          </template>
        </el-table-column>

        <template slot="empty">
          <div class="el-table__empty">
            <svg-icon class="el-table__empty-icon" icon-class="grid-empty-2"></svg-icon>
            <div class="el-table-text">暂无数据</div>
          </div>
        </template>
      </el-table>
      <div class="el-pagination-container">
        <el-pagination
          bordered
          @size-change="localGridSizeChange" @current-change="localGridCurrentChange"
          :current-page="filters.page" :page-size="filters.size"
          :total="Number(tableData.total)">
        </el-pagination>
      </div>
    </custom-container-body>
  </custom-container>
</template>

<script>
  import {proxySubCommissionDetailApi as getApi} from '@/services/api/report';

  import {grid} from '@/build';

  export default {
    name: "low-proxy-detail",
    mixins: [grid],

    props: ['info'],

    data() {
      return {
        filters: {
          settleDate: this.info.settleDate,
          username: undefined,
          page: 1,
          size: 10,
          level: this.info.level
        },
        tableData: {
          total: 0,
          list: []
        }
      };
    },

    mounted() {
      this.bindGet(getApi, 'tableData', {
        action: 'getGrid',
        sendingData: 'filters',
      });

      this.getAll();
    }
  };
</script>

<style scoped>

</style>